-
Notifications
You must be signed in to change notification settings - Fork 123
Fix failing test in worker spec #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix failing test in worker spec #119
Conversation
…is currently processing.
nettofarah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
It might be worth adding a comment to that test and explaining the possible race condition we were running into before these changes
lib/segment/analytics/worker.rb
Outdated
| # | ||
| def is_requesting? | ||
| @lock.synchronize { !@batch.empty? } | ||
| @lock.synchronize { @batch.present? } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this relies on activesupport, which is a dependency you usually don't want to have in more generic gems.
We might wanna change this to use any?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used it as we already have it in our gemspec.
| end | ||
| end | ||
|
|
||
| res = Request.new.post @write_key, @batch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to remove this whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant *new line.
| end | ||
|
|
||
| it 'returns true if there is a current batch' do | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to add this extra line
This PR includes
is_requesting?method of workerreturns true if there is a current batch@benjaminhoffman
Note : Intention of this PR is to re run test in travis